package com.yuanfud.common.util;

import org.apache.commons.lang.RandomStringUtils;

import java.util.UUID;

/**
 * 生成GUID公共类
 * Created by Administrator on 2017/2/13.
 */
public abstract class GuidGenerator
{
    private GuidGenerator() {
    }

    public static String generate() {

        return RandomStringUtils.random(32, true, true);
    }

    public static String generateUUID(){

        String s = UUID.randomUUID().toString();

        //去掉“-”符号
        return s.substring(0,8)+s.substring(9,13)+s.substring(14,18)+s.substring(19,23)+s.substring(24);
    }

    public static String generateClientId() {

        return RandomStringUtils.random(20, true, true);
    }

    public static String generateClientSecret() {

        return RandomStringUtils.random(20, true, true);
    }

    public static String generateRandom(int len){

        return RandomStringUtils.randomAlphanumeric(len);
    }

}
